#ifndef PCI_H
#define PCI_H

#include <Types.h>

/*BIOS32 Service Directory*/
struct bios32_sd_s{
	char	sig[4];		//сигнатура _32_
	addr_t	entery;		//адрес входа в BIOS32
	char	conf[4];	//
	uint32	pad;
};

struct pci_info_s{
	uint16	hw_mech;
	uint16	ver;
	uint16	bus_nr;
};

extern addr_t *pci_addr;

/*Search PCI BIOS32*/
#define PCI_SCAN_START	0xe0000
#define PCI_SCAN_STOP	0xffff0
//$PCI
#define PCI_SIG			0x49435024

#define PCI_FUNCTION_ID			0xb1
#define PCI_BIOS_PRESENT		0x1
#define FIND_PCI_DEVICE			0x2
#define FIND_PCI_CLASS_CODE		0x3
#define GENERATE_SPECIAL_CYCLE	0x6
#define READ_CONFIG_BYTE		0x8
#define READ_CONFIG_WORD		0x9
#define READ_CONFIG_DWORD		0xa
#define WRITE_CONFIG_BYTE		0xb
#define WRITE_CONFIG_WORD		0xc
#define WRITE_CONFIG_DWORD		0xd
#define GET_IRQ_ROUTING_OPTIONS	0xe
#define SET_PCI_IRQ				0xf

#define SUCCESSFUL				0x0
#define FUNC_NOT_SUPPORTED		0x81
#define BAD_VENDOR_ID			0x83
#define DEVICE_NOT_FOUND		0x86
#define BAD_REGISTER_NUMBER		0x87
#define SET_FAILED				0x88
#define BUFFER_TO_SMALL			0x89



#endif /* PCI_H */

